/**
 * 
 */
package com.zhiyou.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou.mapper.CourseMapper;
import com.zhiyou.pojo.Course;
import com.zhiyou.pojo.CourseExample;
import com.zhiyou.pojo.CourseExample.Criteria;
import com.zhiyou.service.CourseService;

@Service
public class CourseServiceImpl implements CourseService{

	@Autowired
	private CourseMapper courseMapper;
	public List<Course> selectCourseBysubjectId(int subjectId) {
		CourseExample courseExample=new CourseExample();
	    Criteria createCriteria = courseExample.createCriteria();
		createCriteria.andSubjectIdEqualTo(subjectId);
		
		List<Course> courses=courseMapper.selectByExampleWithBLOBs(courseExample);
	    return courses;
	}
	
	public Course selectCourseBycourseId(int course_id) {
		CourseExample courseExample=new CourseExample();
		Criteria createCriteria = courseExample.createCriteria();
		createCriteria.andIdEqualTo(course_id);
		return courseMapper.selectByPrimaryKey(course_id);
	}

}
